//
//  signUpCollectionCell.m
//  doubleEduStudents
//
//  Created by 盛洋 on 2021/1/12.
//  Copyright © 2021 shengYang. All rights reserved.
//

#import "signUpCollectionCell.h"

@implementation signUpCollectionCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.join_btn.titleLabel.font = AutoLabFont2;
    self.status_btn.titleLabel.font = self.title_lab.font = self.time_lab.font = self.look_lab.font = self.join_lab.font =AutoLabFont3;
}

-(void)setModel:(AliefuModel *)model{
    _model = model;
    if (_model.status == 0) {
        //未开始
        [_status_btn setBackgroundImage:[UIImage imageNamed:@"aliefu_unstart"] forState:UIControlStateNormal];
        [_status_btn setTitle:@"未开始" forState:UIControlStateNormal];
        [self.join_btn setHidden:YES];
    }else if (_model.status == 1){
        //报名中
        [_status_btn setBackgroundImage:[UIImage imageNamed:@"aliefu_ing"] forState:UIControlStateNormal];
         [_status_btn setTitle:@"报名中" forState:UIControlStateNormal];
        [self.join_btn setHidden:NO];
    }else if (_model.status == 2){
        //评奖中
        [_status_btn setBackgroundImage:[UIImage imageNamed:@"aliefu_start"] forState:UIControlStateNormal];
         [_status_btn setTitle:@"评奖中" forState:UIControlStateNormal];
        [self.join_btn setHidden:YES];
    }else if (_model.status == 3){
        //已结束
        [_status_btn setBackgroundImage:[UIImage imageNamed:@"aliefu_unstart"] forState:UIControlStateNormal];
         [_status_btn setTitle:@"已结束" forState:UIControlStateNormal];
        [self.join_btn setHidden:YES];
    }
    _look_lab.text = [NSString stringWithFormat:@"%ld",_model.lookPeople];
    _join_lab.text = [NSString stringWithFormat:@"%ld",_model.joinPeople];
    [_top_img sd_setImageWithURL:[NSURL URLWithString:_model.photo] placeholderImage:[UIImage imageNamed:@"back_view"]];
    _title_lab.text = _model.name;
    if (_model.startTime.length > 10) {
        _model.startTime = [_model.startTime substringToIndex:10];
    }else{
        _model.startTime = _model.startTime;
    }
    if (_model.endTime.length > 10) {
        _model.endTime = [_model.endTime substringToIndex:10];
    }else{
        _model.endTime = _model.endTime;
    }
    _time_lab.text = [NSString stringWithFormat:@"%@ —— %@",_model.startTime,_model.endTime];
    
}

@end
